﻿@model WebSoftSeo.Models.User
@{
    ViewBag.Title = "Register";
    Layout = "~/Views/Shared/_LayoutSubscribe.cshtml";
}

<div class="wrapBlogContent">
        	<div class="container">
            	<!-- blogContentL -->
            	<div class="blogContentL">
                  @using (Html.BeginForm("Register","User", FormMethod.Post, new{enctype="multipart/form-data", id="RegisterForm"}))
                    {
                    <div class="formLogin">
                    	<h2 class="titleLogin">Chưa là thành viên</h2>
                        <ul class="formRes">
                            <li>
                                <label>Họ tên</label>
                                <div class="testboxC">
                                   @* <input type="text" placeholder="Họ tên" class="validation-failed">
                                    <p class="required">Vui lòng nhập tên</p>
                                    <div class="clearfix"></div>*@

                                    @Html.TextBoxFor(m => m.FullName, new {id="FullNameRegister" })
                                       <p id="FullNameRegisterE" class="required"></p>
                                </div>
                            </li>
                            <li>
                                <label>Email</label>
                                <div class="testboxC">
                                   @* <input type="text" placeholder="Email">*@
                                    @if (ViewBag.ErrorEmailR == "" || ViewBag.ErrorEmailR == null)
                                    {
                                    @Html.TextBoxFor(m => m.Email, new {id= "EmailRegister" })
                                    }
                                    else
                                    {
                                        @Html.TextBoxFor(m => m.Email, new {id= "EmailRegister",@class= "validation-failed"})
                                    }
                                    <p id="EmailRegisterE" class="required">@ViewBag.ErrorEmailR</p>
                                    
                                    <div class="clearfix"></div>
                                </div>
                            </li>
                            <li>
                                <label>Mật khẩu</label>
                                <div class="testboxC">
                               @Html.PasswordFor(m=>m.PassWord, new {id= "PassWordRegister" })
                                    <p id="PassWordRegisterE" class="required"></p>
                                    <div class="clearfix"></div>
                                </div>
                            </li>
                            <li>
                                <label>Nhập lại mật khẩu</label>
                                <div class="testboxC">
                                    <input type="password" id="RepasswordRegister" name="Repassword" placeholder="Nhập lại mật khẩu">
                                      <p id="RepasswordRegisterE" class="required"></p>
                                    <div class="clearfix"></div>
                                </div>
                            </li>
                        </ul>
                        <button type="submit" class="button">Đăng kí</button>
                    </div>
                    }
                    
                    <div class="formLogin padd">
                      @using (Html.BeginForm("Login", "User", FormMethod.Post, new { enctype = "multipart/form-data", id = "LoginForm" }))
                        {
                    	<h2 class="titleLogin">Đã là thành viên</h2>
                        <ul class="formRes">
                            <li>
                                <label>Email</label>
                                <div class="testboxC">
                                    @if(ViewBag.ErrorEmail == null)
                                    {
                                    @Html.TextBoxFor(m=>m.Email, new {id= "EmailLogin" })
                                    }
                                    else
                                    {
                                       @Html.TextBoxFor(m=>m.Email, new {id= "EmailLogin",@class= "validation-failed" }) 
                                    }
                                   @* <input type="text" placeholder="Email" class="validation-failed">*@                                 
                                     <p id="EmailLoginE" class="required">@ViewBag.ErrorEmail</p>
                                   
                                    <div class="clearfix"></div>
                                </div>
                            </li>
                            <li>
                                <label>Mật khẩu</label>
                                <div class="testboxC">
                                    @Html.PasswordFor(m=>m.PassWord, new {id= "PassWordLogin" })
                                     <p class="required">@ViewBag.ErrorPassWord</p>
                                    <p id="PassWordLoginE" class="required"></p>
                                   @* <input type="text" placeholder="Mật khẩu">*@
                                    <div class="clearfix"></div>
                                </div>
                            </li>
                            <li><a href="#">Quên mật khẩu?</a></li> 
                        </ul>
                        <button type="submit" class="button lef">Đăng nhập</button>
                        }
                    </div>  
                                  
                    <div class="clearfix"></div>
                </div>
                <!-- End blogContentL -->
                <!-- blogContentR -->
            	<div class="blogContentR divRes">
                	<div class="listCate">
                    	<h2>Categories</h2>
                        <ul>
                        	<li><a href="#">Technical Corner</a></li>
                            <li><a href="#">Lorem ipsum dolor sit amet </a></li>
                            <li><a href="#">ipsum dolor sit amet </a></li>
                            <li><a href="#">Corner Technical</a></li>
                            <li><a href="#">Technical Corner</a></li>
                        </ul>
                    </div>
                    <div class="clearfix"></div>
                    <h2 class="h1Sibar">Popular Articles</h2>
                    <div class="listMonth">
                        <div class="wrapMonth">
                            <h2 class="titleM">2013</h2>
                            <ul class="month">
                                <li><a href="#">January</a></li>
                                <li><a href="#">January</a></li>
                                <li><a href="#">January</a></li>
                                <li><a href="#">January</a></li>
                                <li><a href="#">January</a></li>
                                <li><a href="#">January</a></li>
                                <li><a href="#">January</a></li>
                                <li><a href="#">January</a></li>
                                <li><a href="#">January</a></li>
                                <li><a href="#">January</a></li>
                                <li><a href="#">January</a></li>
                                <li><a href="#">January</a></li>
                            </ul>
                            <div class="clearfix"></div>
                        </div>
                        <div class="wrapMonth">
                            <h2 class="titleM">2012</h2>
                            <ul class="month">
                                <li><a href="#">January</a></li>
                                <li><a href="#">January</a></li>
                                <li><a href="#">January</a></li>
                                <li><a href="#">January</a></li>
                                <li><a href="#">January</a></li>
                                <li><a href="#">January</a></li>
                                <li><a href="#">January</a></li>
                                <li><a href="#">January</a></li>
                                <li><a href="#">January</a></li>
                                <li><a href="#">January</a></li>
                                <li><a href="#">January</a></li>
                                <li><a href="#">January</a></li>
                            </ul>
                            <div class="clearfix"></div>
                        </div>
                        <div class="wrapMonth">
                            <h2 class="titleM">2011</h2>
                            <ul class="month">
                                <li><a href="#">January</a></li>
                                <li><a href="#">January</a></li>
                                <li><a href="#">January</a></li>
                                <li><a href="#">January</a></li>
                                <li><a href="#">January</a></li>
                                <li><a href="#">January</a></li>
                                <li><a href="#">January</a></li>
                                <li><a href="#">January</a></li>
                                <li><a href="#">January</a></li>
                                <li><a href="#">January</a></li>
                                <li><a href="#">January</a></li>
                                <li><a href="#">January</a></li>
                            </ul>
                            <div class="clearfix"></div>
                        </div>
                    </div>
                </div>
                <!-- End blogContentR -->
                <div class="clearfix"></div>
            </div>
        </div>
        <!-- End Content Blog -->
<script type="text/javascript">

    function isValidEmailAddress(emailAddress) {
        var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
        return pattern.test(emailAddress);
    }
</script>

<script type="text/javascript">
   
    function ValidateRegister() {
            var FullNameRegister = $("#FullNameRegister").val();
            var EmailRegister = $("#EmailRegister").val();
            var PassWordRegister = $("#PassWordRegister").val();
            var RepasswordRegister = $("#RepasswordRegister").val();
            if (FullNameRegister == "" || EmailRegister == "" || PassWordRegister == "" || RepasswordRegister == "") {
                if (RepasswordRegister == "") {
                    $("#RepasswordRegisterE").html("Vui lòng nhập lại mật khẩu");
                    $("#RepasswordRegister").addClass("validation-failed");
                    $("#RepasswordRegister").focus();
                }
                if (PassWordRegister == "") {
                    $("#PassWordRegisterE").html("Vui lòng nhập mật khẩu");
                    $("#PassWordRegister").addClass("validation-failed");
                    $("#PassWordRegister").focus();
                }
                if (EmailRegister == "") {
                    $("#EmailRegisterE").html("Vui lòng nhập Email");
                    $("#EmailRegister").addClass("validation-failed");
                    $("#EmailRegister").focus();

                }
                if (FullNameRegister == "") {
                    $("#FullNameRegisterE").html("Vui lòng nhập tên");
                    $("#FullNameRegister").addClass("validation-failed");
                    $("#FullNameRegister").focus();
                }
                return false;
            }
            if (!isValidEmailAddress(EmailRegister))
            {
                $("#EmailRegisterE").html("Email không hợp lệ");
                $("#EmailRegister").addClass("validation-failed");
                $("#EmailRegister").focus();
                return false;
            }
            if (PassWordRegister != RepasswordRegister)
            {
                $("#RepasswordRegisterE").html("Mật khẩu nhập lại không trùng khớp");
                $("#RepasswordRegister").addClass("validation-failed");
                $("#RepasswordRegister").focus();
                return false;
            }

            return true;
        }
      
    

</script>
<script type="text/javascript">
    $("#PassWordRegister").blur(function () {
        var pass = $('#PassWordRegister').val();
        if (pass != "") {
            document.getElementById("PassWordRegisterE").innerHTML = "";
            $("#PassWordRegister").removeClass("validation-failed")
        }
    });
</script>
<script type="text/javascript">
    $("#FullNameRegister").blur(function () {
        var name = $('#FullNameRegister').val();
        if (name != "") {
            document.getElementById("FullNameRegisterE").innerHTML = "";
            $("#FullNameRegister").removeClass("validation-failed")
        }
    });
</script>
<script type="text/javascript">
    $("#EmailRegister").blur(function () {
        var Email = $('#EmailRegister').val();
        if (Email != "") {
            document.getElementById("EmailRegisterE").innerHTML = "";
            $("#EmailRegister").removeClass("validation-failed")
        }
    });
</script>
<script type="text/javascript">
    $("#RepasswordRegister").blur(function () {
        var repass = $('#RepasswordRegister').val();
        if (repass != "") {
            document.getElementById("RepasswordRegisterE").innerHTML = "";
            $("#RepasswordRegister").removeClass("validation-failed")
        }
    });
</script>
<script type="text/javascript">
    $('#RegisterForm').submit(function () {
       
        return ValidateRegister();

    });
</script>

<script type="text/ecmascript">
    function VaildateLogin()
    {
        var EmailLogin = $("#EmailLogin").val();
        var PassWordLogin = $("#PassWordLogin").val();
        if (EmailLogin == "" || PassWordLogin == "")
        {
            if (PassWordLogin == "") {
                $("#PassWordLoginE").html("Vui lòng nhập mật khẩu");
                $("#PassWordLogin").addClass("validation-failed");
                $("#PassWordLogin").focus();
            }
            if (EmailLogin == "")
            {
                $("#EmailLoginE").html("Vui lòng nhập Email");
                $("#EmailLogin").addClass("validation-failed");
                $("#EmailLogin").focus();

            }
           
            return false;
        }
        if (!isValidEmailAddress(EmailLogin))
        {
            $("#EmailLoginE").html("Email không hợp lệ");
            $("#EmailLogin").addClass("validation-failed");
            $("#EmailLogin").focus();
            return false;
        }
        return true;
    }
</script>
<script type="text/javascript">
    $("#EmailLogin").blur(function () {
        var Email = $('#EmailLogin').val();
        if (Email != "") {
            document.getElementById("EmailLoginE").innerHTML = "";
            $("#EmailLogin").removeClass("validation-failed");

        }
    });
</script>
<script type="text/javascript">
    $("#PassWordLogin").blur(function () {
        var pass = $('#PassWordLogin').val();
        if (pass != "") {
            document.getElementById("PassWordLoginE").innerHTML = "";
            $("#PassWordLogin").removeClass("validation-failed");
        }
    });
</script>
<script type="text/javascript">
    $('#LoginForm').submit(function () {

        return VaildateLogin();

    });
</script>
